<%@ page import="sell.DbTest" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: webrx
  Date: 2017/6/14
  Time: 17:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>服装列表</title>
    <style>
        .cc{
            margin: 100px auto;
        }
        .cc th,td{
            border: 1px solid hotpink;
            text-align: center;
        }

        .page{}
        .page a{
           /* display: inline-block;
            padding: 3px;
            line-height: 20px;
            margin: 0px 5px;
            min-width: 23px;
            border: 1px solid hotpink;
            text-decoration: none;*/
            display: inline-block;
            padding:5px;
            line-height: 40px;
            margin: 0px 10px ;
            min-width:40px;
            border: 1px solid #ccaccb;
            text-decoration: none;

        }
        .page a:hover{
            background-color: #bafdff;
        }
        .page span{
            display: inline-block;
            padding: 3px;
            line-height: 20px;
            margin: 0px 5px;
            min-width: 23px;
            border: 1px solid #f6ff0e;

        }
        .page span:hover{
            border: 2px solid chartreuse;
        }
    </style>
</head>
<body>
<table class="cc" cellspacing="0">

    <tr>
        <th>ID</th>
        <th>名称</th>
        <th>描述</th>
        <th>上级ID</th>
        <th>价格</th>
        <th>添加时间</th>
        <th>图片</th>
        <th>基本操作</th>
    </tr>

        <%
            DbTest db = new DbTest();
            db.setPagesize(2);
            int currpage  = request.getParameter("p")==null ? 1 : Integer.parseInt(request.getParameter("p"));
            db.setCurrpage(currpage);
            List<Map<String, Object>> list = db.page("fuzhuang_xiao","*","where 1=1","order by id desc");
            for(Map<String,Object> m : list){
                List<Map<String, Object>> list1=db.query("fuzhang_img","*","where img_pid="+m.get("xiao_pid"),"","limit 1");
                m.put("img",list1.get(0).get("img_name"));
               /* System.out.println(list1.size());
                System.out.println(list1.get(0).get("img_name"));*/
            }
            pageContext.setAttribute("list2",list);
        %>

       <c:forEach items="${list2}" var="li">

           <tr>
        <td>${li.id}</td>
        <td>${li.xiao_name}</td>
        <td>${li.xiao_content}</td>
        <td>${li.xiao_pid}</td>
        <td>${li.xiao_price}</td>
        <td>${li.xiao_time}</td>
        <td><img src="../upload/fuzhuang/small/${li.img}" style="width: 40px;height: 40px"></td>
        <td>删除</td>

    </tr>
    </c:forEach>
    <tr>
        <td colspan="10"><%=db.pageInfo()%></td>
    </tr>
</table>
</body>
</html>
